package io.renren.service.impl;

import com.baomidou.mybatisplus.core.conditions.query.QueryWrapper;
import io.renren.commons.mybatis.service.impl.CrudServiceImpl;
import io.renren.dao.WorkerDao;
import io.renren.dto.WorkerDTO;
import io.renren.entity.WorkerEntity;
import io.renren.service.WorkerService;
import org.apache.commons.lang3.StringUtils;
import org.springframework.stereotype.Service;

import java.util.Map;

/**
 * 维修人员
 *
 * @author liuyujun 384880231@qq.com
 * @since 3.0 2022-01-13
 */
@Service
public class WorkerServiceImpl extends CrudServiceImpl<WorkerDao, WorkerEntity, WorkerDTO> implements WorkerService {

    @Override
    public QueryWrapper<WorkerEntity> getWrapper(Map<String, Object> params){
        QueryWrapper<WorkerEntity> wrapper = new QueryWrapper<>();

        String name = (String)params.get("name");
        wrapper.like(StringUtils.isNotBlank(name), "name", name);
        String phone = (String)params.get("phone");
        wrapper.like(StringUtils.isNotBlank(phone), "phone", phone);

        return wrapper;
    }


}